﻿@{
    ViewBag.Title = "Quản lý cấp mã đăng nhập";
    Layout = "~/Views/Shared/_LayoutAdmin.cshtml";
}
<script src="~/Scripts/jquery.validate.js"></script>
<script src="~/Scripts/jquery.validate.unobtrusive.js"></script>

<script>
    var HouseNumber = "";
    var AreaId = "";
    var HouseHoldName = "";
    var StatusGenerateCode = "";
    var StatusPrint = "";
    $(document).ready(function () {
        $("#inExcel").click(function () {
            var searchInfo = getSearchInfo();
            var straction = '@Url.Action("ExportData", "PrintLoginCode")';

            //vanduong, 17/07/0125
            //window.open(straction + '?HouseNumber=' + searchInfo.HouseNumber +
            window.location.href = straction + '?HouseNumber=' + searchInfo.HouseNumber +
                '&AreaId=' + searchInfo.AreaId +
                '&HouseHoldName=' + searchInfo.HouseHoldName +
                '&StatusGenerateCode=' + searchInfo.StatusGenerateCode +
                '&StatusPrint=' + searchInfo.StatusPrint;
            //, 'DownLoadExcel', 'window DownloadExcel';
        });
    });

    function getSearchInfo() {
        return {
            HouseNumber: $("#HouseNumber_store").val(),
            AreaId: $("#areaId_store").val(),
            HouseHoldName: $("#HouseHoldName_store").val(),
            StatusGenerateCode: $("#StatusGenerateCode_store").val(),
            StatusPrint: $("#StatusPrint_store").val()
        };
    }
</script>

@Html.Hidden("StatusGenerateCode_store", ViewData["StatusGenerateCode"])
@Html.Hidden("HouseNumber_store", ViewData["HouseNumber"])
@Html.Hidden("StatusPrint_store", ViewData["StatusPrint"])
@Html.Hidden("HouseHoldName_store", ViewData["HouseHoldName"])
@Html.Hidden("areaId_store", ViewData["areaId"])

@model DHQGHN.PM2.Controllers.SearchPrintLoginCodeModel

<div class="page-bar">
    <ul class="page-breadcrumb" style="padding: 4px;">
        <li>
            <i class="fa fa-home"></i>
            <a href="#"> Quản lý cấp mã đăng nhập</a>
        </li>
    </ul>
</div>

@using (@Html.BeginForm("Index", "PrintLoginCode", FormMethod.Get))
{
    @Html.AntiForgeryToken()
    <div class="container" style="width:100%;">
        <div class="row">
            <label class="col-sm-2 ">Trạng thái hoàn thành</label>
            <div class="col-sm-4">
                @Html.RadioButtonFor(m => m.StatusGenerateCode, "1")
                @*<input type="radio" name="StatusGenerateCode" id="StatusGenerateCode" value="1">*@
                Đã hoàn thành

                @*<input type="radio" name="StatusGenerateCode" id="StatusGenerateCode" value="0">*@
                @Html.RadioButtonFor(m => m.StatusGenerateCode, "0")
                Chưa hoàn thành
            </div>
            <label class="col-sm-2 " style="display:none;">Trạng thái in</label>
            <div class="col-sm-4" style="display:none;">
                @*<input type="radio" name="StatusPrint" id="StatusPrint" value="1">*@
                @Html.RadioButtonFor(m => m.StatusPrint, "1")
                Đã in

                @Html.RadioButtonFor(m => m.StatusPrint, "0")
                Chưa in
            </div>

        </div>
        <div class="row" style="margin-top:5px;">
            <label class="col-sm-2 ">Địa bàn</label>
            <div class="col-sm-4">
                @Html.DropDownListFor(m => m.AreaId, ViewBag.LIST_AREA as List<SelectListItem>, new { @class = "form-control input-sm" })
            </div>
            <label class="col-sm-2 ">Tên chủ hộ</label>
            <div class="col-sm-4">
                @Html.TextBoxFor(m => m.HouseHoldName, new { @class = "form-control input-sm" })
                @*<input class="form-control input-sm" id="HouseHoldName" name="HouseHoldName" />*@
            </div>

        </div>

        <div class="row" style="margin-top:5px;">
            <label class="col-sm-2 " style="display:none;">Mã hộ</label>
            <div class="col-sm-4" style="display:none;">
                @Html.TextBoxFor(m => m.HouseNumber, new { @class = "form-control input-sm" })
                @*<input class="form-control input-sm" id="HouseNumber" name="HouseNumber" />*@
            </div>

            <div class="col-sm-12">
                <div class="pull-right">
                    <button type="submit" id="btnSearch" class="btn btn-sm btn-default">
                        <i class="fa fa-search"></i> Tìm kiếm
                    </button>
                    <button id="inExcel" type="button" class="btn btn-sm btn-default btn_search_household"><i class="fa fa-file-excel-o"></i> Kết xuất Excel</button>
                    @*@Html.ActionLink("Kết xuất excel","ExportExcel", "PrintLoginCode", new { @AreaId = Model.AreaId, @CommuneId = Model.CommuneId, @HouseHoldName = @Model.HouseHoldName, @HouseNumber = Model.HouseNumber, @StatusPrint = Model.StatusPrint, @StatusGenerateCode = Model.StatusGenerateCode, @PageSize = Model.PageSize, @PageIndex = Model.PageIndex }, new { @class = "btn btn-sm btn-default" })*@
                </div>
            </div>
        </div>
    </div>
    <div>
        @if (ViewData["searchResult"] != null)
        {
            <center>
                @Html.Partial("_PrintLoginCodeSearchResultPartial", ViewData["searchResult"] as List<DHQGHN.PM2.Models.HouseHoldModel>)
            </center>
        }
        else
        {
            <div class="text-danger" align="center">Không tìm thấy kết quả nào phù hợp.</div>
        }

    </div>
}




